package org.dyndns.opendemogroup.optimizer.operations;

import java.util.Random;

import org.junit.Test;

/**
 * A class to test the class RandomParentAlleleCrossover
 */
public class RandomParentAlleleCrossoverTest extends OperationTestBase
{

	public RandomParentAlleleCrossoverTest ( )
	{
		super ( new RandomParentAlleleCrossover ( ) );
	}

	/**
	 * Tests the <i>populateChild</i> method with a typical scenario.
	 */
	@Test
	public void populateChild_Typical ( )
	{
		Random randomSource = new Random ( 42 );

		double[] parentGenomeOne =
		{
			1, 1, 1, 1, 1, 1, 1, 1, 1, 1
		};
		double[] parentGenomeTwo =
		{
			2, 2, 2, 2, 2, 2, 2, 2, 2, 2
		};
		double[] expectedGenomeOne =
		{
			1, 2, 1, 2, 2, 1, 2, 1, 1, 2
		};
		double[] expectedGenomeTwo =
		{
			1, 2, 2, 2, 2, 1, 2, 1, 1, 1
		};

		checkPerform ( parentGenomeOne, parentGenomeTwo, randomSource, null,
			expectedGenomeOne, expectedGenomeTwo );
	}

}
